#!/usr/bin/python
# -*- coding: utf-8 -*-
# -1 -2 -5 -7 #-1
#-23 17 -7 11 -2 1 -34#21

li=raw_input().split()
for i in range(len(li)):
    li[i]=int(li[i])
#print li
mx=li[0]
cnt=0
for i in range(len(li)+1):
    for j in range(i+1,len(li)+1):
        cnt=sum(li[i:j])
        if cnt> mx :mx=cnt
print mx